package pl.butler.cezary.syncTool.scanning.detectors;

import java.io.File;
import pl.butler.cezary.syncTool.scanning.ChangeStatus;
import pl.butler.cezary.syncTool.storage.CheckSumUtils;
import pl.butler.cezary.syncTool.storage.metadata.FileVersionMetadata;

class ChecksumBasedDetector implements IDetector {

    private final CheckSumUtils checksumUtils = new CheckSumUtils();
    
    public ChangeStatus checkIfChanged(File plik, FileVersionMetadata metadane) {
        final String checksum  = checksumUtils.calclulateChecksum(plik);
        return checksum.equals(metadane.getSumaKontrolna())?ChangeStatus.NONE:ChangeStatus.CHANGED;

    }
}
